package com.myh.controllers;

import com.myh.service.interfaces.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("userInfo")
public class UserInfoController {

    private String in ="";
    private final IUserInfoService userInfoService;

    @Autowired
    public UserInfoController(IUserInfoService seckillService) {
        this.userInfoService = seckillService;
    }


    /**
     * 用户注册
     * @return
     */
    @RequestMapping(value = "/reg",method = RequestMethod.GET)
    @ResponseBody
    public String register(@RequestParam Map<String, Object> param){


        userInfoService.registerUser(param);

        return "success";
    }


    /**
     *  用户登陆
     * @return
     */
    @RequestMapping(value = "/login",method = RequestMethod.GET)
    @ResponseBody
    public String loginUser(@RequestParam Map<String, Object> param)
    {

        String result = userInfoService.loginUser(param);
        return result;
    }

}
